g_object_unref (view);
}
-typedef GtkCellView MyCellView;
-typedef GtkCellViewClass MyCellViewClass;
-
-GType my_cell_view_get_type (void);
-
-G_DEFINE_TYPE (MyCellView, my_cell_view, GTK_TYPE_CELL_VIEW)
-
-static void
-my_cell_view_class_init (MyCellViewClass *klass)
-{
-}
-
-static void
-my_cell_view_init (MyCellView *view)
-{
- GtkCellArea *area;
-
- if (subclass_init == 0)
- {
- /* do nothing to area */
- }
- else if (subclass_init == 1)
- {
- area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view));
- g_assert (GTK_IS_CELL_AREA_BOX (area));
- g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_HORIZONTAL);
- gtk_orientable_set_orientation (GTK_ORIENTABLE (area), GTK_ORIENTATION_VERTICAL);
- }
-}
-
-/* test that a cellview subclass has an area */
-static void
-test_cellview_subclass0 (void)
-{
- GtkWidget *view;
- GtkCellArea *area;
-
- subclass_init = 0;
-
- view = g_object_new (my_cell_view_get_type (), NULL);
- area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view));
- g_assert (GTK_IS_CELL_AREA_BOX (area));
- g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_HORIZONTAL);
-
- g_object_ref_sink (view);
- g_object_unref (view);
-}
-
-/* test that a cellview subclass keeps the provided area */
-static void
-test_cellview_subclass1 (void)
-{
- GtkWidget *view;
- GtkCellArea *area;
-
- subclass_init = 0;
-
- area = gtk_cell_area_box_new ();
- view = g_object_new (my_cell_view_get_type (), "cell-area", area, NULL);
- g_assert (area == gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view)));
- g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_HORIZONTAL);
-
- g_object_ref_sink (view);
- g_object_unref (view);
-}
-
-/* test we can access the area in subclass init */
-static void
-test_cellview_subclass2 (void)
-{
- GtkWidget *view;
- GtkCellArea *area;
-
- subclass_init = 1;
-
- view = g_object_new (my_cell_view_get_type (), NULL);
- area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view));
- g_assert (GTK_IS_CELL_AREA_BOX (area));
- g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_VERTICAL);
-
- g_object_ref_sink (view);
- g_object_unref (view);
-}
-
-static void
-test_cellview_subclass3_subprocess (void)
-{
- GtkWidget *view;
- GtkCellArea *area;
-
- subclass_init = 1;
-
- area = gtk_cell_area_box_new ();
- view = g_object_new (my_cell_view_get_type (), "cell-area", area, NULL);
- g_assert (area == gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view)));
- g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_VERTICAL);
-
- g_object_ref_sink (view);
- g_object_unref (view);
-}
-
-/* test we get a warning if an area is provided, but ignored */
-static void
-test_cellview_subclass3 (void)
-{
- g_test_trap_subprocess ("/tests/cellview-subclass3/subprocess", 0, 0);
- g_test_trap_assert_failed ();
- g_test_trap_assert_stderr ("*ignoring construct property*");
-}
-
/* test that we have a cell area after new() */
static void
test_column_new (void)
g_test_add_func ("/tests/cellview-new", test_cellview_new);
g_test_add_func ("/tests/cellview-new-with-context", test_cellview_new_with_context);
g_test_add_func ("/tests/cellview-object-new", test_cellview_object_new);
- g_test_add_func ("/tests/cellview-subclass0", test_cellview_subclass0);
- g_test_add_func ("/tests/cellview-subclass1", test_cellview_subclass1);
- g_test_add_func ("/tests/cellview-subclass2", test_cellview_subclass2);
- g_test_add_func ("/tests/cellview-subclass3", test_cellview_subclass3);
- g_test_add_func ("/tests/cellview-subclass3/subprocess", test_cellview_subclass3_subprocess);
g_test_add_func ("/tests/column-new", test_column_new);
g_test_add_func ("/tests/column-new-with-area", test_column_new_with_area);